//
//  KATLabelBar.h
//  KATFramework
//
//  Created by Yi Yu on 2018/3/6.
//  Copyright © 2018年 KatApp. All rights reserved.
//  标签栏


#import "KATSprite.h"
#import "KATShape.h"
#import "KATLabelBarData.h"
#import "KATLabel.h"


@class KATLabelBar;

@protocol KATLabelBarDelegate <NSObject>

@optional

///标签点击事件
- (void)labelBar:(KATLabelBar *)labelBar didSelectWithData:(KATLabelBarData *)data;

@end


@interface KATLabelBar : KATSprite


#pragma -mark 属性

///选中的标签
@property(nonatomic,assign,readonly) int selectedIndex;

///指示器
@property(nonatomic,retain) KATShape *indicator;

///是否填充指示器
@property(nonatomic,assign) BOOL isFilledIndicator;

///指示器中心点y轴坐标
@property(nonatomic,assign) double indicatorPositionY;

///指示器滑动时长
@property(nonatomic,assign) double slidingDuration;

///是否具有渐变效果
@property(nonatomic,assign) BOOL hasGradientEffect;

///选中的颜色(指示器和选中的标签)
@property(nonatomic,retain) UIColor *selectedColor;

///默认的标签样式
@property(nonatomic,retain) KATTextStyle *defaultStyle;

///选中的样式(设置默认样式时自动拷贝默认样式并修改文本颜色)
@property(nonatomic,copy,readonly) KATTextStyle *selectedStyle;

///内间距
@property(nonatomic,assign) double padding;

///外边距
@property(nonatomic,assign) double margin;

///选中的数据
@property(nonatomic,readonly) KATLabelBarData *selectedData;

///数据
@property(nonatomic,retain,readonly) KATArray<KATLabelBarData *> *dataArray;


///事件代理
@property(nonatomic,assign) id<KATLabelBarDelegate> eventDelegate;





#pragma -mark 类方法

///获取实例(默认样式)
+ (instancetype)labelBarWithFrame:(CGRect)frame;



#pragma -mark 对象方法

///加载数据(加载数据后更新控件)
- (void)loadData:(KATArray<KATLabelBarData *> *)dataArray;

///更新控件
- (void)updateView;


///通过index设置选中的标签
- (void)selectWithIndex:(int)index;


///通过data设置选中的标签
- (void)selectedWithData:(KATLabelBarData *)data;


///释放内存
- (void)dealloc;


@end
